home *** CD-ROM | disk | FTP | other *** search
/ Freelog 100 / FreelogNo100-NovembreDecembre2010.iso / Musique / solfege / solfege-win32-3.17.0.exe / {app} / bin / Lib / site-packages / pygtk.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2010-05-04  |  2KB  |  67 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import fnmatch
  5. import glob
  6. import os
  7. import os.path as os
  8. import sys
  9. __all__ = [
  10.     'require']
  11. _our_dir = os.path.dirname(os.path.abspath(os.path.normpath(__file__)))
  12. _pygtk_2_0_dir = os.path.normpath('%s/gtk-2.0' % _our_dir)
  13. _pygtk_dir_pat = 'gtk-[0-9].[0-9]'
  14. _pygtk_required_version = None
  15.  
  16. def _get_available_versions():
  17.     versions = { }
  18.     for dir in sys.path:
  19.         if not dir:
  20.             dir = os.getcwd()
  21.         
  22.         if not os.path.isdir(dir):
  23.             continue
  24.         
  25.         if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat):
  26.             continue
  27.         
  28.         for filename in glob.glob(os.path.join(dir, _pygtk_dir_pat)):
  29.             pathname = os.path.join(dir, filename)
  30.             if not os.path.isdir(pathname):
  31.                 continue
  32.             
  33.             if not os.listdir(pathname):
  34.                 continue
  35.             
  36.             if not versions.has_key(filename[-3:]):
  37.                 versions[filename[-3:]] = pathname
  38.                 continue
  39.         
  40.     
  41.     return versions
  42.  
  43.  
  44. def require20():
  45.     if _pygtk_2_0_dir not in sys.path:
  46.         sys.path.insert(0, _pygtk_2_0_dir)
  47.     
  48.  
  49.  
  50. def require(version):
  51.     global _pygtk_required_version
  52.     if version == '2.0':
  53.         return require20()
  54.     
  55.     if _pygtk_required_version != None:
  56.         return None
  57.     
  58.     versions = _get_available_versions()
  59.     for dir in sys.path:
  60.         if fnmatch.fnmatchcase(os.path.basename(dir), _pygtk_dir_pat):
  61.             sys.path.remove(dir)
  62.             continue
  63.     
  64.     sys.path.insert(0, versions[version])
  65.     _pygtk_required_version = version
  66.  
  67.